﻿using System.Windows;
using Example;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Services.Dialogs;
using YJTMedicalAideManage.MAM;
using YJTMedicalAideManage.Views;

namespace YJTMedicalAideManage
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<LoginView>();
        }
        private static bool isWindowOpen = false;
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
        }
        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            moduleCatalog.AddModule<MAMModule>(); ;
        }
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            if (!isWindowOpen)
            {
                
            }
            else
            {
                // 如果已经有窗体打开，可以选择关闭应用或显示提示
                MessageBox.Show("应用程序已经运行一个实例。", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                Application.Current.Shutdown();  // 关闭应用
            }
        }
    }
}
